package io.gitee.zhangbinhub.acp.boot.test

import io.gitee.zhangbinhub.acp.boot.websocket.AcpWebSocketClient
import org.noear.solon.annotation.Component
import java.nio.ByteBuffer

@Component
class TestWebSocketClient : AcpWebSocketClient() {
    override fun sessionOpen(handle: WebSocketClientHandle) {
        logAdapter.info("session open")
    }

    override fun sessionClose(handle: WebSocketClientHandle?, code: Int, reason: String?, remote: Boolean) {
        logAdapter.info("session close")
    }

    override fun sessionError(handle: WebSocketClientHandle?, throwable: Throwable?) {
        logAdapter.error("session error: ${throwable?.message}")
    }

    override fun receiveMessage(handle: WebSocketClientHandle?, message: String?) {
        logAdapter.info("收到消息：$message")
    }

    override fun receiveMessage(handle: WebSocketClientHandle?, message: ByteBuffer?) {
        logAdapter.info("收到消息：$message")
    }
}
